home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 001a / rbcomm32.zip / EXAMPLES.MAC < prev    next >
Text File  |  1990-07-29  |  3KB  |  93 lines

  1. ; RBcomm macro examples
  2. ;
  3. ;   by Ralf Brown
  4.  
  5. ;---------------------------------------------------------------
  6. ; beep every half hour
  7. ;   continues until another macro file loaded or some other binding
  8. ;   issues a CANCEL_DELAYED ALL
  9. ;
  10. ; first, define #199 to have the name HalfHourBeep
  11. #defkey HalfHourBeep 199
  12.  
  13. F2      DELAYED 1800
  14.        CALL HalfHourBeep      ; 200-255 are reserved
  15.  
  16. HalfHourBeep MULTI
  17.     BEEP
  18.     DELAYED 1800
  19.        CALL #199          ; note: same as HalfHourBeep
  20.      END
  21.  
  22. ; I have been asked "why CALL instead of PUSHKEY?" and "why doesn't the second
  23. ; CALL cause some kind of infinite loop?"
  24. ;
  25. ; The difference between PUSHKEY and CALL is that PUSHKEY #199 will not cause
  26. ; the #199 macro to execute until the next time RBcomm reads the keyboard at
  27. ; the terminal emulation level (it would be discarded by the line-input
  28. ; function, for example).  The CALL executes immediately and then continues
  29. ; execution with the next line of the macro (if any).  As written, the 'beep
  30. ; every half hour' macro will cause a beep even if currently executing another
  31. ; macro; with PUSHKEY, the beep would not occur until the current macro
  32. ; completes--unless the macro is/will execute a command which takes input, in
  33. ; which case the #199 will be lost, ending the repetition.  You don't get an
  34. ; infinite nesting because the DELAYED command simply stores a pointer and the
  35. ; desired time, then exits.  Thus, the macro works something like this:
  36. ;
  37. ;     create an event for CALL #199
  38. ;     exit F2
  39. ;     ...
  40. ;     time to wake up and execute the CALL #199
  41. ;         BEEP
  42. ;         create an event for CALL #199
  43. ;         exit #199
  44. ;     exit CALL #199
  45. ;     ...
  46. ;     time to wake up again and execute the CALL #199
  47. ;         BEEP
  48. ;         create an event for CALL #199
  49. ;         exit #199
  50. ;     exit CALL #199
  51. ;     ...
  52. ;     time to wake up again and execute the CALL #199
  53. ;     etc.
  54. ;
  55. ; As you can see, at any given time, there is at most one pending event and one
  56. ; invocation of #199.
  57.  
  58. ;---------------------------------------------------------------
  59. ; display a time-limited message without DESQview message-box
  60. ;    note: should be on top-most row to avoid a mess if screen scrolls during
  61. ;       wait interval
  62. ;
  63. F3    MULTI
  64.     MESSAGE 0 50 "^[[0;5mTimed test message"
  65.     DELAYED 3
  66.        MESSAGE 0 50 "                  "   ; same length as orig message
  67.      END
  68.  
  69. ;---------------------------------------------------------------
  70. ; repeatedly try to elicit a response from the remote system
  71. ; abort after ten minutes of no response
  72. ;
  73. F4    MULTI
  74.     DELAYED 600
  75.        ABORT_UNTIL       ; give up after ten minutes
  76.     UNTIL SUCCESS
  77.        {
  78.        TEXT "\r"
  79.        WAITFOR 2 "login:"
  80.        }
  81.     CANCEL_DELAYED LAST  ; no more need for the timed abort
  82.      END
  83.  
  84. ;---------------------------------------------------------------
  85. ; notify user of any incoming calls (only for DESQview and Hayes-comp modems)
  86. ;
  87. OnLoad     WHEN 0 "RING^M"
  88.      NOTIFY "Phone is ringing"
  89.  
  90. ;---------------------------------------------------------------
  91. ; add the standard bindings which have not been overridden
  92. #include "rbcomm"
  93.